
package com.rt.schedulenew.service.impl;

import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.HashMap;
import com.rt.schedulebase.dto.ExamApplyDto;
import com.rt.schedulebase.dto.ExamApplyItemDto;
import com.rt.schedulebase.entity.ExamApplyItem;
import com.rt.schedulebase.mapper.ExamApplyItemMapper;
import java.util.List;
import org.springframework.stereotype.Service;
import com.rt.schedulenew.api.IExamApplyItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

@Service
public class ExamApplyItemServiceImpl extends ServiceImpl<ExamApplyItemMapper, ExamApplyItem> implements IExamApplyItemService {

    @Override
    public List<ExamApplyItemDto> getList(ExamApplyItemDto dto) {
        return baseMapper.getList(dto);
    }

    @Override
    public List<ExamApplyItemDto> selectOtherSchedule(ExamApplyDto dto) {
        return baseMapper.selectOtherSchedule(dto);
    }

    @Override
    public List<ExamApplyItem> selectList(ExamApplyItemDto dto) {
        Map<String, Object> map = new HashMap<>();
        map.put("APPLY_NO", dto.getApplyNo());
        map.put("ITEM_NO", dto.getItemNo());
        map.put("ORDER_NO", dto.getOrderNo());
        QueryWrapper<ExamApplyItem> queryWrapper = new QueryWrapper<>();
        queryWrapper.allEq(map, false);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public int updateItem(ExamApplyItem dto) {
        Map<String, Object> map = new HashMap<>();
        map.put("APPLY_NO", dto.getApplyNo());
        map.put("ITEM_NO", dto.getItemNo());
        map.put("ORDER_NO", dto.getOrderNo());
        QueryWrapper<ExamApplyItem> queryWrapper = new QueryWrapper<>();
        queryWrapper.allEq(map);
        return baseMapper.update(dto, queryWrapper);
    }
}
